package com.zj.controller;

import com.zj.controller.request.AccountRegisterDto;
import com.zj.result.R;
import com.zj.service.AccountService;
import com.zj.service.UploadService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @author 自己的名字
 * @version 1.0.0
 * @ClassName UserController
 * @Description user
 * @createTime 2024年12月10日 21:39
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private AccountService accountService;

    @Autowired
    private UploadService uploadService;

    @PostMapping("/register")
    public R<Boolean> register(@RequestBody AccountRegisterDto accountRegisterDto){
        return R.data(accountService.register(accountRegisterDto));
    }

    @PostMapping("/upload")
    public R<String> upload(@RequestPart("file")MultipartFile file){
        return R.data(uploadService.upload(file));
    }
}
